package com.qh.physicsexperiment.domin;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qh.physicsexperiment.utils.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@TableName("student")
@Data
@NoArgsConstructor  //空参构造方法
@AllArgsConstructor //全参构造方法
@Accessors(chain = true)//作用是使成员属性的set方法不再返回void，而是返回对象本身，从而实现链式赋值。
@EqualsAndHashCode(callSuper = true)//父类属性不参与equal
@ApiModel(value="Student对象", description="学生信息")
public class Student extends BaseEntity {

    /**
     * 学生号
     */
    @ApiModelProperty(value = "学号",notes = "用作登录账号，无自增",required = true,allowableValues = "10",dataType = "Long")
    @NotBlank(message = "账号不能为空")
    private Long id;

    /**
     * 学生姓名
     */
    @ApiModelProperty(value = "学生姓名",allowableValues = "String")
    private String name;

    /**
     * 学生密码
     */
    @ApiModelProperty(value = "学生密码",notes = "用于学生登录，默认123456",required = true,allowableValues = "20",dataType = "String")
    @NotBlank(message = "密码不能为空")
    @TableField(value = "password",select = false)
    private String pwd;

    /**
     * 班级编号
     */
    @ApiModelProperty(value = "班级编号",required = true,allowableValues = "8",dataType = "Long")
    @Pattern(regexp = "^d{8}$",message = "班级编号不对")
    private Long cid;

    //反序列化唯一标识？没看懂
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
